import request from '@/utils/request2'
import qs from 'qs'

/**
 * 加载数据
 * @param data
 */
export function getAllActivity(id) {
  return request({
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    url: '/a1bpmn/api/model/activity/'+id,
    method: 'GET',
  })
}
/**
 * 获取所有的任务节点以及连线
 * @param data
 */
export function getAllActivityAndSequence(id) {
  return request({
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    url: '/a1bpmn/api/model/sequence/'+id,
    method: 'GET',
  })
}

/**
 * 自动跳过设置获取接口
 * @param id
 */
export function getAllActivityAndSkipNode(id) {
  return request({
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    url: '/a1bpmn/api/model/skip/'+id,
    method: 'GET',
  })
}
export function getAllActivityAndBackModel(id) {
  return request({
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    url: '/a1bpmn/api/model/backModel/'+id,
    method: 'GET',
  })
}
export function getAllActivityAndBusinessFormSettingModelModel(id) {
  return request({
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    url: '/a1bpmn/api/model/businessFormSettingModel/'+id,
    method: 'GET',
  })
}
export function saveNodeBackModel(id,data) {
  return request({
    headers: {
      'Content-Type': 'application/json'

    },
    url: '/a1bpmn/api/model/backModel/save/'+id,
    method: 'POST',
    data: JSON.stringify(data)
  })
}



/**
 * 加载数据
 * @param data
 */
export function saveModelBus(id,data) {
  return request({
    headers: {
      'Content-Type': 'application/json'

    },
    url: '/a1bpmn/api/model/bus/'+id,
    method: 'POST',
    data: JSON.stringify(data)


  })
}
/**
 * 加载数据
 * @param data
 */
export function saveModelBusSequence(id,data) {
  return request({
    headers: {
      'Content-Type': 'application/json'

    },
    url: '/a1bpmn/api/model/sequence/save//'+id,
    method: 'POST',
    data: JSON.stringify(data)
  })
}
export function saveNodeSkip(id,data) {
  return request({
    headers: {
      'Content-Type': 'application/json'

    },
    url: '/a1bpmn/api/model/skip/save/'+id,
    method: 'POST',
    data: JSON.stringify(data)
  })
}

/**
 * 业务表单设置保存
 * @param id
 * @param data
 */
export function saveBusinessFormSettingModel(id,data) {
  return request({
    headers: {
      'Content-Type': 'application/json'

    },
    url: '/a1bpmn/api/model/businessFormSettingModel/save/'+id,
    method: 'POST',
    data: JSON.stringify(data)
  })
}
/**
 * 获取任务插件
 * @param data
 */
export function saveModelTaskInfo(id,data) {
  return request({
    headers: {
      'Content-Type': 'application/json'

    },
    url: '/a1bpmn/api/model/urging/save/'+id,
    method: 'POST',
    data: JSON.stringify(data)
  })
}
export function saveModelExpireTaskInfo(id,data) {
  return request({
    headers: {
      'Content-Type': 'application/json'

    },
    url: '/a1bpmn/api/model/expire/save/'+id,
    method: 'POST',
    data: JSON.stringify(data)


  })
}

/**
 * 获取历史节点
 * @param id
 */
export function getAllHisActivity(id) {
  return request({
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    url: '/a1bpmn/api/restart/his/instance/'+id,
    method: 'GET',
  })
}
/**
 * 获取模板节点
 * @param id
 */
export function getAllUrgingActivity(id) {
  return request({
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    url: '/a1bpmn/api/model/urging/'+id,
    method: 'GET',
  })
}
/**
 * 获取到期模板节点
 * @param id
 */
export function getAllExpireActivity(id) {
  return request({
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    url: '/a1bpmn/api/model/expire/'+id,
    method: 'GET',
  })
}

/**
 * 重启实例
 * @param id
 */
export function restartSave(data) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    url: '/a1bpmn/api/cockpit/process-instance/v2/restart',

    method: 'POST',
    data: JSON.stringify(data)
  })
}

/**
 * 人员预览
 * @param id
 */
export function getAllActivityUser(id) {
  return request({
    url: '/a1bpmn/api/model/user/'+id,
    method: 'GET',
  })
}






